import java.util.Stack;
public class Task2 {
	
	static int x = 17;
	static int y = 3;

	
	public static void main(String[] args) 
	
	{
		
		Stack<Integer> myStack = new Stack();
		myStack.push(x);
		myStack.push(y);

		swapStack(myStack);

	}
	
	
	static boolean moreThanTwoElement(Stack<Integer> stackInput_1)
	{
		boolean result = false;
			if (stackInput_1.empty() == false)
			{
				int temp_value = stackInput_1.pop();
				if (stackInput_1.empty() == false)
				{
					result = true;
				}
				stackInput_1.push(temp_value);
			}
		return result;
	}
	
	static void swapStack(Stack<Integer> stackInput)
	{
		if (moreThanTwoElement(stackInput) == true)
		{
			int last_number  = stackInput.pop();
			int second_last_number = stackInput.pop();
			stackInput.push(last_number);
			stackInput.push(second_last_number);
		}

	}
}
